package org.vectrics.recruiter.struts.admin;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import javax.servlet.jsp.JspException;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.struts.VectricsStrutsAction;
import org.vectrics.struts.VectricsActionData;
import org.vectrics.user.Person;


public class LocationRemoveAction extends VectricsStrutsAction {
	public static final long serialVersionUID = 22520952;
    private transient static Logger log = Logger.getLogger(LocationRemoveAction.class);
	public static String LOCATION_PARAM = "location";


	public String doExecute(VectricsActionData actionData)	throws JspException {
		ActionForm form = actionData.getForm();
		if (form == null) {
			log.info("form is null");
		}
		else {
			log.info("Form class = " + form.getClass().getName());
			LocationForm locationForm = (LocationForm)form;
			
			log.info("doRender() called");
			Person person = actionData.getAuthPerson();

			String locationId = locationForm.getId();

			log.info("execute() - locationId = " + locationId);
			CoreServiceLocator.getLocationService().removeLocation(person, new Long(locationId));
		}
		return ("success");
	}
}
